package com.roam.controller;


import com.roam.VO.DisplaySceneVO;
import com.roam.VO.PopularSceneVO;
import com.roam.result.Result;
import com.roam.service.HomePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class HomePageController {


    @Autowired
    private HomePageService homePageService;
    @CrossOrigin
    @GetMapping("/home/get")
    public Result popularScenes(){
        int num1 =4;
        int num2 =10;
        ArrayList<DisplaySceneVO> displaySceneVOS = homePageService.displayScenes(num1);
        ArrayList<PopularSceneVO> popularSceneVOS = homePageService.popularScenes(num2);

        // 创建一个包含 displayScenes 和 popularScenes 的 Map 对象
        Map<String, Object> homePageData = new LinkedHashMap<>();
        homePageData.put("displayScenes", displaySceneVOS);
        homePageData.put("popularScenes", popularSceneVOS);
        return Result.success(homePageData);
    }



}
